package com.travel.utils;

import org.springframework.context.ApplicationContext;

public class BeanUtil {
    private static ApplicationContext applicationContext;

    public static void setApplicationContext(ApplicationContext applicationContext) {
        BeanUtil.applicationContext = applicationContext;
    }

    public static ApplicationContext getApplicationContext() {
        return applicationContext;
    }

    public static <T>T getBean(Class<T> clazz,String name){
        return getApplicationContext().getBean(name,clazz);
    }
}